<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.List"%>
<%@page trimDirectiveWhitespaces="true" %>
	<%-- 定义网页搜索引擎索引方式，通常有如下几种取值：none，noindex，nofollow，all，index和follow --%>
	<jsp:useBean id="user" class="ajaxjs.data.user.UserEmpty" />
	<meta name="robots" content="noindex,nofollow" />
	<script>
		// 管理接口的 url 根（全局变量）
		serviceUrl = "../../admin_service/";
	</script>
	<%
boolean isLogin = ajaxjs.data.user.Login.isLoginedBySession(session);
if(!isLogin && request.getRequestURI().indexOf("admin.jsp") == -1){
	%>
		<%@taglib prefix="commonUI" 	tagdir="/WEB-INF/tags/common/UI"%>
		<commonUI:baseDialog title="登录" className="loginDlg">
			<input type="hidden" name="name" value="admin" />
			<div align="center" style="margin:30px 0;">请输入 ADMIN 密码：<input required type="password" name="password" /></div>
		</commonUI:baseDialog>
		<script>
			seajs.use(['bigfoot/widget/dialog', 'bigfoot/dhtml/form/form', 'libs/md5_2.js'], function(
					_dialog, _form){
				var dialog = Object.create(_dialog.dialog);
				dialog.init(document.querySelector('.loginDlg_tpl'));
				dialog.el.querySelector('.hide').removeCls('hide');
		
				var form = Object.create(_form);
				form.action = '../../service/user/login';
				form.formEl = dialog.el.querySelector('form');
				form.beforeSubmit = function(){
	               var password = form.formEl.querySelector('input[name=password]');
	               password.value = md5(password.value);
	            }
				form.onSubmitSuccuess = function(result){
					form.formEl.reset();
					if(result.isOk){
					  alert('登录成功！');
					  dialog.close();
					}else{
					 alert(result.msg);
					}
				}
				form.init();
				
				//bf.patch.fixSubmit_on_enter_press(formEl);
			});
		</script>
<%}%>